import 'package:my_soft/configs/my_style.dart';
import 'package:my_soft/pages/home/logic.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

class BuildAppBar extends StatelessWidget {
  final logic = Get.put(HomeLogic());
  BuildAppBar({super.key});

  @override
  Widget build(BuildContext context) {
    return SliverAppBar(
      //是否固定头布局 默认false
      pinned: true,
      //是否浮动 默认false
      // floating: true,
      // snap: true,
      backgroundColor: Colors.white,
      expandedHeight: MediaQuery.of(context).size.height / 4,
      leading: Container(
        margin: const EdgeInsets.all(10),
        child: Image.asset("images/logo.png", width: 64, height: 64, fit: BoxFit.fill),
      ),
      // elevation: 2.0, 景深
      // title: const Text(
      //   "番茄是水果",
      //   style: TextStyle(color: MyColor.deepBlack, shadows: [Shadow(color: MyColor.deepGrey, offset: Offset(-1, 1), blurRadius: 2)]),
      // ),
      flexibleSpace: FlexibleSpaceBar(
        background: Image.asset("images/mzsm.png"),
        collapseMode: CollapseMode.parallax,
        // centerTitle: true,
        titlePadding: const EdgeInsets.only(left: 40, right: 40, bottom: 5),
        title: const SizedBox(
          height: 30,
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text(
                "番茄是水果",
                style: TextStyle(color: MyColor.deepBlack, fontSize: 14),
              ),
              // Obx(() {
              //   return Visibility(
              //     visible: logic.processShow.value,
              //     child: LinearProgressIndicator(
              //       value: logic.process.value,
              //       backgroundColor: Colors.white24,
              //       color: Colors.redAccent,
              //     ),
              //   );
              // }),
            ],
          ),
        ),
        // title: const Text(
        //   "番茄是水果",
        //   style: TextStyle(color: MyColor.deepBlack, fontSize: 12, shadows: [Shadow(color: MyColor.deepGrey, offset: Offset(-1, 1), blurRadius: 2)]),
        // ),
      ),
    );
  }
}
